
run essentials_Table_10B.do

		************************************************************************
		********************REGRESSIONS using NON-PERFORMANCE**********************
		************************************************************************
		
		
		*** Tables for paper using non-performance
			
			* For low-income borrowers
				
				foreach var in lowincB {
								
					* Poisson for number of defaults
					foreach depvar in num_defaults {
							
						local regnum = 1
						
						* r1 - r3 using time and local-area
						eststo r`regnum': poisson `depvar' post_constr_lowincA constr_lowincA post_constr post_lowincA post dtr50 lowincA i.time i.local_auth if lowincB == 1, vce(cluster local_auth) exposure(exp_lt)
							quietly estadd local time "Yes": r`regnum'
							quietly estadd local fixed_l "Yes": r`regnum'
							quietly estadd local interactions "Yes" : r`regnum'
							local regnum = `regnum' + 1
						eststo r`regnum': poisson `depvar' post_constr_lowincA constr_lowincA post_constr post_lowincA post dtr50 lowincA i.time i.local_auth if lowincB == 0, vce(cluster local_auth) exposure(exp_lt)
							quietly estadd local time "Yes": r`regnum'
							quietly estadd local fixed_l "Yes": r`regnum'
							quietly estadd local interactions "Yes" : r`regnum'
							local regnum = `regnum' + 1
						eststo r`regnum': poisson `depvar' post_constr_lowincA_`var' post_constr_lowincA post_constr_`var' post_lowincA_`var' constr_lowincA_`var' post_constr post_lowincA post_`var' constr_`var' lowincA_`var' constr_lowincA dtr50 lowincA `var' post i.time i.local_auth, vce(cluster local_auth) exposure(exp_lt)
							quietly estadd local time "Yes": r`regnum'
							quietly estadd local fixed_l "Yes": r`regnum'
							quietly estadd local interactions "Yes" : r`regnum'
							local regnum = `regnum' + 1
						
						* Triple interaction with region*time and county*time FE
						eststo r`regnum': poisson `depvar' post_constr_lowincA_`var' post_constr_lowincA post_constr_`var' post_lowincA_`var' constr_lowincA_`var' post_constr post_lowincA post_`var' constr_`var' lowincA_`var' constr_lowincA dtr50 lowincA `var' post i.reg_constr_time i.reg_lowincA_time i.local_auth, vce(cluster local_auth) exposure(exp_lt)
							quietly estadd local fixed_l "Yes": r`regnum'
							quietly estadd local f_reg_constr_time "Yes": r`regnum'
							quietly estadd local f_reg_lowincA_time "Yes": r`regnum'
							quietly estadd local interactions "Yes" : r`regnum'
							local regnum = `regnum' + 1
						eststo r`regnum': poisson `depvar' post_constr_lowincA_`var' post_constr_lowincA post_constr_`var' post_lowincA_`var' constr_lowincA_`var' post_constr post_lowincA post_`var' constr_`var' lowincA_`var' constr_lowincA dtr50 lowincA `var' post i.reg_constr_time i.reg_lowincA_time i.county_time i.local_auth, vce(cluster local_auth) exposure(exp_lt)
							quietly estadd local fixed_l "Yes": r`regnum'
							quietly estadd local f_reg_constr_time "Yes": r`regnum'
							quietly estadd local f_reg_lowincA_time "Yes": r`regnum'
							quietly estadd local f_county_time "Yes": r`regnum'
							quietly estadd local interactions "Yes" : r`regnum'
							local regnum = `regnum' + 1	
							
							
							#delimit ;
							esttab r1 r2 r3 r4 r5 using REV_Table10B.tex, label replace nonotes se keep(post_constr_lowincA_lowincB post_constr_lowincA) booktabs 
							s(N r2 time fixed_l f_reg_constr_time f_reg_lowincA_time f_county_time interactions,label("Observations" "\(R^{2}\)" "Time FE" "Local area FE" "Region\$\times\$Constr\$\times\$Time FE" "Region\$\times\$LowInc\$\times\$Time FE" "County\$\times\$Time FE" "Low-level int.")) 
							mgroups("Num. of non-performing mortgages in 2017H2", pattern(1 0 0 0 0) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span}) lhs("Variable")) 
							nodepvars nomtitles;
							#delimit cr
							
							
							* clear estimates
							eststo clear
							
				
			
				}
									
			}
			
			
